package cn.javass.dp.command.example4;

public class AddCommand implements Command {

    //1持有具体计算机对象
    private OperationApi operation = null;

    /**
     * 操作的数据  这是加功能
     */
    private int opeNum;

    public AddCommand(OperationApi operation, int opeNum) {
        this.operation = operation;
        this.opeNum = opeNum;
    }

    @Override
    public void execute() {
        this.operation.add(opeNum);
    }

    /**
     * 撤销操作 + 就变成-
     */
    @Override
    public void undo() {
        this.operation.substract(opeNum);

    }
}
